package expression;

import echecs.Etat;
import java.util.List;

public class SiChaine implements Expression {

    private List<Expression> arg1;
    private List<Expression> arg2;

    public SiChaine(List<Expression> arg1, List<Expression> arg2) {
        this.arg1 = arg1;
        this.arg2 = arg2;
    }

    @Override
    public Object f(Etat etat) {
        for (int p = 0; p < arg1.size(); p++) {
            if ((Boolean) arg1.get(p).f(etat)) {
                arg2.get(p).f(etat);
            }
        }
        return etat;
    }
}
